const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
  // 认证相关
  invoke: (channel, data) => ipcRenderer.invoke(channel, data),
  
  // 事件监听
  onAuthStatus: (callback) => ipcRenderer.on('authentication-status', callback),
  onAuthSuccess: (callback) => ipcRenderer.on('authentication-success', callback),
  
  // 清理监听器
  removeAllListeners: (channel) => ipcRenderer.removeAllListeners(channel),
  
  // 打开目录功能
  openDirectory: (path) => ipcRenderer.invoke('open-directory', path)
});